<!--
 * @Author: DaHuaZhuXi
 * @Date: 2020-11-23 15:13:03
 * @LastEditTime: 2020-12-07 21:36:36
 * @LastEditors: DaHuaZhuXi
 * @Description: 世界地图
-->
<template>
  <div class="scrollWrap">
    <div class="disTable">
      <div class="disTableCell">
        <div class="disInblock menuBtns">
          <!-- 主内容 S -->
          <van-button
            v-for="item in places"
            :key="item.id"
            icon="smile-o"
            :block="true"
            :disabled="isPeosEmpty(item)"
            @click="clickBtn(item)"
            >{{ item.type }}</van-button
          >
          <!-- 主内容 E -->
        </div>
      </div>
    </div>
    <HeaderBar></HeaderBar>
    <FooterNav></FooterNav>
  </div>
</template>

<script>
export default {
  data() {
    return {
      places: window.data.places
    }
  },
  computed: {
    // 没有队员的情况下，智能访问我的城市
    isPeosEmpty() {
      return function (item) {
        if (item.id == 0) return false;
        return game.curSave.myTeam.length == 0
      }
    }
  },
  created() {
    // 清除迷宫数据
    this.$store.commit("clearMazeData");
  },
  mounted() {
  },

  methods: {
    clickBtn(item) {
      if (item.id == 0) {
        this.$router.push("/City");
      } else {
        this.placeId = item.id;
        this.$store.commit("updateMazeData", this);
        this.$router.push({name:"Maze"});
      }
    }
  },
}
</script>
